Make maximum number of supported physical CPUs a compile-time
authorkaf24@firebug.cl.cam.ac.uk <kaf24@firebug.cl.cam.ac.uk>
Wed, 29 Mar 2006 13:54:43 +0000 (14:54 +0100)
committerkaf24@firebug.cl.cam.ac.uk <kaf24@firebug.cl.cam.ac.uk>
Wed, 29 Mar 2006 13:54:43 +0000 (14:54 +0100)
option via the 'max_phys_cpus=<nr>' compilation parameter.

Based on a patch from Aravindh Puthiyaparambil at Unisys.

Signed-off-by: Keir Fraser <keir@xensource.com>
xen/Rules.mk
xen/arch/x86/smpboot.c
xen/arch/x86/x86_64/mm.c
xen/include/asm-x86/config.h

index 55aab4c95e41d85bfc81636dd58757fa7873fef8..f887ea44f502cede6aeb9767bb402e606bc65885 100644 (file)
@@ -51,6 +51,10 @@ CFLAGS-$(crash_debug)  += -DCRASH_DEBUG
 CFLAGS-$(perfc)        += -DPERF_COUNTERS
 CFLAGS-$(perfc_arrays) += -DPERF_ARRAYS
 
+ifneq ($(max_phys_cpus),)
+CFLAGS-y               += -DMAX_PHYS_CPUS=$(max_phys_cpus)
+endif
+
 ALL_OBJS := $(ALL_OBJS-y)
 CFLAGS   := $(strip $(CFLAGS) $(CFLAGS-y))
 
index 5427c42f2760dec97bb8d5250b0c07c4cde52c4b..498c2b5ba2ebad1052ded354f4460439c1f04951 100644 (file)
@@ -880,18 +880,30 @@ static int __devinit do_boot_cpu(int apicid, int cpu)
  * Returns zero if CPU booted OK, else error code from wakeup_secondary_cpu.
  */
 {
-       struct vcpu *v;
        unsigned long boot_error;
        int timeout;
        unsigned long start_eip;
        unsigned short nmi_high = 0, nmi_low = 0;
+       struct domain *d;
+       struct vcpu *v;
+       int vcpu_id;
 
        ++cpucount;
 
-       v = idle_vcpu[cpu] = alloc_vcpu(idle_vcpu[0]->domain, cpu, cpu);
-        BUG_ON(v == NULL);
+       if ((vcpu_id = cpu % MAX_VIRT_CPUS) == 0) {
+               d = domain_create(IDLE_DOMAIN_ID, cpu);
+               BUG_ON(d == NULL);
+               v = d->vcpu[0];
+       } else {
+               d = idle_vcpu[cpu - vcpu_id]->domain;
+               BUG_ON(d == NULL);
+               v = alloc_vcpu(d, vcpu_id, cpu);
+       }
+
+       idle_vcpu[cpu] = v;
+       BUG_ON(v == NULL);
 
-        v->arch.monitor_table = mk_pagetable(__pa(idle_pg_table));
+       v->arch.monitor_table = mk_pagetable(__pa(idle_pg_table));
 
        /* start_eip had better be page-aligned! */
        start_eip = setup_trampoline();
index aa51f434e95694bd8589fb259ea5ec7c70811ba4..ee8a1a9bf3d31cad66e8e495d4c83b1a15f19eae 100644 (file)
@@ -148,12 +148,14 @@ void subarch_init_memory(void)
     if ( ((offsetof(struct page_info, u.inuse._domain) != 
            (offsetof(struct page_info, count_info) + sizeof(u32)))) ||
          ((offsetof(struct page_info, count_info) & 7) != 0) ||
-         (sizeof(struct page_info) != 40) )
+         (sizeof(struct page_info) !=
+          (32 + BITS_TO_LONGS(NR_CPUS)*sizeof(long))) )
     {
-        printk("Weird page_info layout (%ld,%ld,%ld)\n",
+        printk("Weird page_info layout (%ld,%ld,%ld,%ld)\n",
                offsetof(struct page_info, count_info),
                offsetof(struct page_info, u.inuse._domain),
-               sizeof(struct page_info));
+               sizeof(struct page_info),
+               32 + BITS_TO_LONGS(NR_CPUS)*sizeof(long));
         for ( ; ; ) ;
     }
 
index b901ed303641be6f69d7d0a3d780e0a376014c68..3360a2a5a0a8677524b4308d8bc33059e0156329 100644 (file)
 
 #define OPT_CONSOLE_STR "com1,vga"
 
+#ifdef MAX_PHYS_CPUS
+#define NR_CPUS MAX_PHYS_CPUS
+#else
 #define NR_CPUS 32
+#endif
+
+#if defined(__i386__) && (NR_CPUS > 32)
+#error "Maximum of 32 physical processors supported by Xen on x86_32"
+#endif
 
 #ifdef CONFIG_X86_SUPERVISOR_MODE_KERNEL
 # define supervisor_mode_kernel (1)